/*
 * Robot.cpp
 *
 *  Created on: 12 nov. 2012
 *      Author: guegan
 */

#include "Robot.h"
#include "AVide.h"
#include "EtatRobot.h"


Robot::Robot(string direction, int x, int y) : _direction(direction) {

	_position = new Position(x, y);
	_obstacle = NULL;
	_objet = NULL;
	_ordre = "";
	_etat = AVide::instance();
	_etat->creerEtats();

	EtatRobot::setRobot(this);

}

void Robot::avancer(int x, int y){
     _ordre = "avancer";
    _etat->avancer(x,y);

    notifier();
}


void Robot::tourner(string direction){
     _ordre="tourner";
	_etat->tourner(direction);

	notifier();
}

void Robot::saisir(Objet o){
     _ordre="saisir";
	_etat->saisir(o);

	notifier();
}

void Robot::poser(){
     _ordre="poser";
	_etat->poser();

	notifier();
}

int Robot::peser(){
    _ordre="peser";
	return _etat->peser();

	notifier();
}

void Robot::rencontrerObstacle(Obstacle o){
     _ordre="rencontrerObstacle";
	_etat->rencontrerObstacle(o);

	notifier();
}

int Robot::evaluerObstacle(){
    _ordre="evaluerObstacle";
	return _etat->evaluerObstacle();

	notifier();
}

void Robot::figer(){
     _ordre="figer";
	_etat->figer();

	notifier();
}

void Robot::repartir(){
     _ordre="repartir";
	_etat->repartir();

	notifier();
}


void Robot::setEtatRobot(EtatRobot* etat){
	_etat = etat;
}

Robot::~Robot(){
}
